<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>zgbbrd.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="ZGBBRD.1"></a><a href="zgbbrd.f.html#ZGBBRD.1">ZGBBRD</a>( VECT, M, N, NCC, KL, KU, AB, LDAB, D, E, Q,
     $                   LDQ, PT, LDPT, C, LDC, WORK, RWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      CHARACTER          VECT
      INTEGER            INFO, KL, KU, LDAB, LDC, LDPT, LDQ, M, N, NCC
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      DOUBLE PRECISION   D( * ), E( * ), RWORK( * )
      COMPLEX*16         AB( LDAB, * ), C( LDC, * ), PT( LDPT, * ),
     $                   Q( LDQ, * ), WORK( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="ZGBBRD.21"></a><a href="zgbbrd.f.html#ZGBBRD.1">ZGBBRD</a> reduces a complex general m-by-n band matrix A to real upper
</span><span class="comment">*</span><span class="comment">  bidiagonal form B by a unitary transformation: Q' * A * P = B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The routine computes B, and optionally forms Q or P', or computes
</span><span class="comment">*</span><span class="comment">  Q'*C for a given matrix C.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  VECT    (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment">          Specifies whether or not the matrices Q and P' are to be
</span><span class="comment">*</span><span class="comment">          formed.
</span><span class="comment">*</span><span class="comment">          = 'N': do not form Q or P';
</span><span class="comment">*</span><span class="comment">          = 'Q': form Q only;
</span><span class="comment">*</span><span class="comment">          = 'P': form P' only;
</span><span class="comment">*</span><span class="comment">          = 'B': form both.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix A.  M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix A.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  NCC     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix C.  NCC &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KL      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of subdiagonals of the matrix A. KL &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  KU      (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of superdiagonals of the matrix A. KU &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  AB      (input/output) COMPLEX*16 array, dimension (LDAB,N)
</span><span class="comment">*</span><span class="comment">          On entry, the m-by-n band matrix A, stored in rows 1 to
</span><span class="comment">*</span><span class="comment">          KL+KU+1. The j-th column of A is stored in the j-th column of
</span><span class="comment">*</span><span class="comment">          the array AB as follows:
</span><span class="comment">*</span><span class="comment">          AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)&lt;=i&lt;=min(m,j+kl).
</span><span class="comment">*</span><span class="comment">          On exit, A is overwritten by values generated during the
</span><span class="comment">*</span><span class="comment">          reduction.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDAB    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array A. LDAB &gt;= KL+KU+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  D       (output) DOUBLE PRECISION array, dimension (min(M,N))
</span><span class="comment">*</span><span class="comment">          The diagonal elements of the bidiagonal matrix B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  E       (output) DOUBLE PRECISION array, dimension (min(M,N)-1)
</span><span class="comment">*</span><span class="comment">          The superdiagonal elements of the bidiagonal matrix B.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Q       (output) COMPLEX*16 array, dimension (LDQ,M)
</span><span class="comment">*</span><span class="comment">          If VECT = 'Q' or 'B', the m-by-m unitary matrix Q.
</span><span class="comment">*</span><span class="comment">          If VECT = 'N' or 'P', the array Q is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDQ     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array Q.
</span><span class="comment">*</span><span class="comment">          LDQ &gt;= max(1,M) if VECT = 'Q' or 'B'; LDQ &gt;= 1 otherwise.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  PT      (output) COMPLEX*16 array, dimension (LDPT,N)
</span><span class="comment">*</span><span class="comment">          If VECT = 'P' or 'B', the n-by-n unitary matrix P'.
</span><span class="comment">*</span><span class="comment">          If VECT = 'N' or 'Q', the array PT is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDPT    (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array PT.
</span><span class="comment">*</span><span class="comment">          LDPT &gt;= max(1,N) if VECT = 'P' or 'B'; LDPT &gt;= 1 otherwise.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  C       (input/output) COMPLEX*16 array, dimension (LDC,NCC)
</span><span class="comment">*</span><span class="comment">          On entry, an m-by-ncc matrix C.
</span><span class="comment">*</span><span class="comment">          On exit, C is overwritten by Q'*C.
</span><span class="comment">*</span><span class="comment">          C is not referenced if NCC = 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDC     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array C.
</span><span class="comment">*</span><span class="comment">          LDC &gt;= max(1,M) if NCC &gt; 0; LDC &gt;= 1 if NCC = 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) COMPLEX*16 array, dimension (max(M,N))
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  RWORK   (workspace) DOUBLE PRECISION array, dimension (max(M,N))
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0:  successful exit.
</span><span class="comment">*</span><span class="comment">          &lt; 0:  if INFO = -i, the i-th argument had an illegal value.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      DOUBLE PRECISION   ZERO
      PARAMETER          ( ZERO = 0.0D+0 )
      COMPLEX*16         CZERO, CONE
      PARAMETER          ( CZERO = ( 0.0D+0, 0.0D+0 ),
     $                   CONE = ( 1.0D+0, 0.0D+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      LOGICAL            WANTB, WANTC, WANTPT, WANTQ
      INTEGER            I, INCA, J, J1, J2, KB, KB1, KK, KLM, KLU1,
     $                   KUN, L, MINMN, ML, ML0, MU, MU0, NR, NRT
      DOUBLE PRECISION   ABST, RC
      COMPLEX*16         RA, RB, RS, T
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="XERBLA.120"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZLARGV.120"></a><a href="zlargv.f.html#ZLARGV.1">ZLARGV</a>, <a name="ZLARTG.120"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>, <a name="ZLARTV.120"></a><a href="zlartv.f.html#ZLARTV.1">ZLARTV</a>, <a name="ZLASET.120"></a><a href="zlaset.f.html#ZLASET.1">ZLASET</a>, <a name="ZROT.120"></a><a href="zrot.f.html#ZROT.1">ZROT</a>,
     $                   ZSCAL
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          ABS, DCONJG, MAX, MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL            <a name="LSAME.127"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL           <a name="LSAME.128"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters
</span><span class="comment">*</span><span class="comment">
</span>      WANTB = <a name="LSAME.134"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'B'</span> )
      WANTQ = <a name="LSAME.135"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'Q'</span> ) .OR. WANTB
      WANTPT = <a name="LSAME.136"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'P'</span> ) .OR. WANTB
      WANTC = NCC.GT.0
      KLU1 = KL + KU + 1
      INFO = 0
      IF( .NOT.WANTQ .AND. .NOT.WANTPT .AND. .NOT.<a name="LSAME.140"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( VECT, <span class="string">'N'</span> ) )
     $     THEN
         INFO = -1
      ELSE IF( M.LT.0 ) THEN
         INFO = -2
      ELSE IF( N.LT.0 ) THEN
         INFO = -3
      ELSE IF( NCC.LT.0 ) THEN
         INFO = -4
      ELSE IF( KL.LT.0 ) THEN
         INFO = -5
      ELSE IF( KU.LT.0 ) THEN
         INFO = -6
      ELSE IF( LDAB.LT.KLU1 ) THEN
         INFO = -8
      ELSE IF( LDQ.LT.1 .OR. WANTQ .AND. LDQ.LT.MAX( 1, M ) ) THEN
         INFO = -12
      ELSE IF( LDPT.LT.1 .OR. WANTPT .AND. LDPT.LT.MAX( 1, N ) ) THEN
         INFO = -14
      ELSE IF( LDC.LT.1 .OR. WANTC .AND. LDC.LT.MAX( 1, M ) ) THEN
         INFO = -16
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.163"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZGBBRD.163"></a><a href="zgbbrd.f.html#ZGBBRD.1">ZGBBRD</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Initialize Q and P' to the unit matrix, if needed
</span><span class="comment">*</span><span class="comment">
</span>      IF( WANTQ )
     $   CALL <a name="ZLASET.170"></a><a href="zlaset.f.html#ZLASET.1">ZLASET</a>( <span class="string">'Full'</span>, M, M, CZERO, CONE, Q, LDQ )
      IF( WANTPT )
     $   CALL <a name="ZLASET.172"></a><a href="zlaset.f.html#ZLASET.1">ZLASET</a>( <span class="string">'Full'</span>, N, N, CZERO, CONE, PT, LDPT )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible.
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.EQ.0 .OR. N.EQ.0 )
     $   RETURN
<span class="comment">*</span><span class="comment">
</span>      MINMN = MIN( M, N )
<span class="comment">*</span><span class="comment">
</span>      IF( KL+KU.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Reduce to upper bidiagonal form if KU &gt; 0; if KU = 0, reduce
</span><span class="comment">*</span><span class="comment">        first to lower bidiagonal form and then transform to upper
</span><span class="comment">*</span><span class="comment">        bidiagonal
</span><span class="comment">*</span><span class="comment">
</span>         IF( KU.GT.0 ) THEN
            ML0 = 1
            MU0 = 2
         ELSE
            ML0 = 2
            MU0 = 1
         END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Wherever possible, plane rotations are generated and applied in
</span><span class="comment">*</span><span class="comment">        vector operations of length NR over the index set J1:J2:KLU1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        The complex sines of the plane rotations are stored in WORK,
</span><span class="comment">*</span><span class="comment">        and the real cosines in RWORK.
</span><span class="comment">*</span><span class="comment">
</span>         KLM = MIN( M-1, KL )
         KUN = MIN( N-1, KU )
         KB = KLM + KUN
         KB1 = KB + 1
         INCA = KB1*LDAB
         NR = 0
         J1 = KLM + 2
         J2 = 1 - KUN
<span class="comment">*</span><span class="comment">
</span>         DO 90 I = 1, MINMN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Reduce i-th column and i-th row of matrix to bidiagonal form
</span><span class="comment">*</span><span class="comment">
</span>            ML = KLM + 1
            MU = KUN + 1
            DO 80 KK = 1, KB
               J1 = J1 + KB
               J2 = J2 + KB
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              generate plane rotations to annihilate nonzero elements
</span><span class="comment">*</span><span class="comment">              which have been created below the band
</span><span class="comment">*</span><span class="comment">
</span>               IF( NR.GT.0 )
     $            CALL <a name="ZLARGV.224"></a><a href="zlargv.f.html#ZLARGV.1">ZLARGV</a>( NR, AB( KLU1, J1-KLM-1 ), INCA,
     $                         WORK( J1 ), KB1, RWORK( J1 ), KB1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              apply plane rotations from the left
</span><span class="comment">*</span><span class="comment">
</span>               DO 10 L = 1, KB
                  IF( J2-KLM+L-1.GT.N ) THEN
                     NRT = NR - 1
                  ELSE
                     NRT = NR
                  END IF
                  IF( NRT.GT.0 )
     $               CALL <a name="ZLARTV.236"></a><a href="zlartv.f.html#ZLARTV.1">ZLARTV</a>( NRT, AB( KLU1-L, J1-KLM+L-1 ), INCA,
     $                            AB( KLU1-L+1, J1-KLM+L-1 ), INCA,
     $                            RWORK( J1 ), WORK( J1 ), KB1 )
   10          CONTINUE
<span class="comment">*</span><span class="comment">
</span>               IF( ML.GT.ML0 ) THEN
                  IF( ML.LE.M-I+1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    generate plane rotation to annihilate a(i+ml-1,i)
</span><span class="comment">*</span><span class="comment">                    within the band, and apply rotation from the left
</span><span class="comment">*</span><span class="comment">
</span>                     CALL <a name="ZLARTG.247"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>( AB( KU+ML-1, I ), AB( KU+ML, I ),
     $                            RWORK( I+ML-1 ), WORK( I+ML-1 ), RA )
                     AB( KU+ML-1, I ) = RA
                     IF( I.LT.N )
     $                  CALL <a name="ZROT.251"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( MIN( KU+ML-2, N-I ),
     $                             AB( KU+ML-2, I+1 ), LDAB-1,
     $                             AB( KU+ML-1, I+1 ), LDAB-1,
     $                             RWORK( I+ML-1 ), WORK( I+ML-1 ) )
                  END IF
                  NR = NR + 1
                  J1 = J1 - KB1
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( WANTQ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 accumulate product of plane rotations in Q
</span><span class="comment">*</span><span class="comment">
</span>                  DO 20 J = J1, J2, KB1
                     CALL <a name="ZROT.265"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( M, Q( 1, J-1 ), 1, Q( 1, J ), 1,
     $                          RWORK( J ), DCONJG( WORK( J ) ) )
   20             CONTINUE
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( WANTC ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 apply plane rotations to C
</span><span class="comment">*</span><span class="comment">
</span>                  DO 30 J = J1, J2, KB1
                     CALL <a name="ZROT.275"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( NCC, C( J-1, 1 ), LDC, C( J, 1 ), LDC,
     $                          RWORK( J ), WORK( J ) )
   30             CONTINUE
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( J2+KUN.GT.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 adjust J2 to keep within the bounds of the matrix
</span><span class="comment">*</span><span class="comment">
</span>                  NR = NR - 1
                  J2 = J2 - KB1
               END IF
<span class="comment">*</span><span class="comment">
</span>               DO 40 J = J1, J2, KB1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 create nonzero element a(j-1,j+ku) above the band
</span><span class="comment">*</span><span class="comment">                 and store it in WORK(n+1:2*n)
</span><span class="comment">*</span><span class="comment">
</span>                  WORK( J+KUN ) = WORK( J )*AB( 1, J+KUN )
                  AB( 1, J+KUN ) = RWORK( J )*AB( 1, J+KUN )
   40          CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              generate plane rotations to annihilate nonzero elements
</span><span class="comment">*</span><span class="comment">              which have been generated above the band
</span><span class="comment">*</span><span class="comment">
</span>               IF( NR.GT.0 )
     $            CALL <a name="ZLARGV.301"></a><a href="zlargv.f.html#ZLARGV.1">ZLARGV</a>( NR, AB( 1, J1+KUN-1 ), INCA,
     $                         WORK( J1+KUN ), KB1, RWORK( J1+KUN ),
     $                         KB1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              apply plane rotations from the right
</span><span class="comment">*</span><span class="comment">
</span>               DO 50 L = 1, KB
                  IF( J2+L-1.GT.M ) THEN
                     NRT = NR - 1
                  ELSE
                     NRT = NR
                  END IF
                  IF( NRT.GT.0 )
     $               CALL <a name="ZLARTV.314"></a><a href="zlartv.f.html#ZLARTV.1">ZLARTV</a>( NRT, AB( L+1, J1+KUN-1 ), INCA,
     $                            AB( L, J1+KUN ), INCA,
     $                            RWORK( J1+KUN ), WORK( J1+KUN ), KB1 )
   50          CONTINUE
<span class="comment">*</span><span class="comment">
</span>               IF( ML.EQ.ML0 .AND. MU.GT.MU0 ) THEN
                  IF( MU.LE.N-I+1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                    generate plane rotation to annihilate a(i,i+mu-1)
</span><span class="comment">*</span><span class="comment">                    within the band, and apply rotation from the right
</span><span class="comment">*</span><span class="comment">
</span>                     CALL <a name="ZLARTG.325"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>( AB( KU-MU+3, I+MU-2 ),
     $                            AB( KU-MU+2, I+MU-1 ),
     $                            RWORK( I+MU-1 ), WORK( I+MU-1 ), RA )
                     AB( KU-MU+3, I+MU-2 ) = RA
                     CALL <a name="ZROT.329"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( MIN( KL+MU-2, M-I ),
     $                          AB( KU-MU+4, I+MU-2 ), 1,
     $                          AB( KU-MU+3, I+MU-1 ), 1,
     $                          RWORK( I+MU-1 ), WORK( I+MU-1 ) )
                  END IF
                  NR = NR + 1
                  J1 = J1 - KB1
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( WANTPT ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 accumulate product of plane rotations in P'
</span><span class="comment">*</span><span class="comment">
</span>                  DO 60 J = J1, J2, KB1
                     CALL <a name="ZROT.343"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( N, PT( J+KUN-1, 1 ), LDPT,
     $                          PT( J+KUN, 1 ), LDPT, RWORK( J+KUN ),
     $                          DCONJG( WORK( J+KUN ) ) )
   60             CONTINUE
               END IF
<span class="comment">*</span><span class="comment">
</span>               IF( J2+KB.GT.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 adjust J2 to keep within the bounds of the matrix
</span><span class="comment">*</span><span class="comment">
</span>                  NR = NR - 1
                  J2 = J2 - KB1
               END IF
<span class="comment">*</span><span class="comment">
</span>               DO 70 J = J1, J2, KB1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 create nonzero element a(j+kl+ku,j+ku-1) below the
</span><span class="comment">*</span><span class="comment">                 band and store it in WORK(1:n)
</span><span class="comment">*</span><span class="comment">
</span>                  WORK( J+KB ) = WORK( J+KUN )*AB( KLU1, J+KUN )
                  AB( KLU1, J+KUN ) = RWORK( J+KUN )*AB( KLU1, J+KUN )
   70          CONTINUE
<span class="comment">*</span><span class="comment">
</span>               IF( ML.GT.ML0 ) THEN
                  ML = ML - 1
               ELSE
                  MU = MU - 1
               END IF
   80       CONTINUE
   90    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      IF( KU.EQ.0 .AND. KL.GT.0 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        A has been reduced to complex lower bidiagonal form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Transform lower bidiagonal form to upper bidiagonal by applying
</span><span class="comment">*</span><span class="comment">        plane rotations from the left, overwriting superdiagonal
</span><span class="comment">*</span><span class="comment">        elements on subdiagonal elements
</span><span class="comment">*</span><span class="comment">
</span>         DO 100 I = 1, MIN( M-1, N )
            CALL <a name="ZLARTG.384"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>( AB( 1, I ), AB( 2, I ), RC, RS, RA )
            AB( 1, I ) = RA
            IF( I.LT.N ) THEN
               AB( 2, I ) = RS*AB( 1, I+1 )
               AB( 1, I+1 ) = RC*AB( 1, I+1 )
            END IF
            IF( WANTQ )
     $         CALL <a name="ZROT.391"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( M, Q( 1, I ), 1, Q( 1, I+1 ), 1, RC,
     $                    DCONJG( RS ) )
            IF( WANTC )
     $         CALL <a name="ZROT.394"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( NCC, C( I, 1 ), LDC, C( I+1, 1 ), LDC, RC,
     $                    RS )
  100    CONTINUE
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        A has been reduced to complex upper bidiagonal form or is
</span><span class="comment">*</span><span class="comment">        diagonal
</span><span class="comment">*</span><span class="comment">
</span>         IF( KU.GT.0 .AND. M.LT.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Annihilate a(m,m+1) by applying plane rotations from the
</span><span class="comment">*</span><span class="comment">           right
</span><span class="comment">*</span><span class="comment">
</span>            RB = AB( KU, M+1 )
            DO 110 I = M, 1, -1
               CALL <a name="ZLARTG.409"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>( AB( KU+1, I ), RB, RC, RS, RA )
               AB( KU+1, I ) = RA
               IF( I.GT.1 ) THEN
                  RB = -DCONJG( RS )*AB( KU, I )
                  AB( KU, I ) = RC*AB( KU, I )
               END IF
               IF( WANTPT )
     $            CALL <a name="ZROT.416"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( N, PT( I, 1 ), LDPT, PT( M+1, 1 ), LDPT,
     $                       RC, DCONJG( RS ) )
  110       CONTINUE
         END IF
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Make diagonal and superdiagonal elements real, storing them in D
</span><span class="comment">*</span><span class="comment">     and E
</span><span class="comment">*</span><span class="comment">
</span>      T = AB( KU+1, 1 )
      DO 120 I = 1, MINMN
         ABST = ABS( T )
         D( I ) = ABST
         IF( ABST.NE.ZERO ) THEN
            T = T / ABST
         ELSE
            T = CONE
         END IF
         IF( WANTQ )
     $      CALL ZSCAL( M, T, Q( 1, I ), 1 )
         IF( WANTC )
     $      CALL ZSCAL( NCC, DCONJG( T ), C( I, 1 ), LDC )
         IF( I.LT.MINMN ) THEN
            IF( KU.EQ.0 .AND. KL.EQ.0 ) THEN
               E( I ) = ZERO
               T = AB( 1, I+1 )
            ELSE
               IF( KU.EQ.0 ) THEN
                  T = AB( 2, I )*DCONJG( T )
               ELSE
                  T = AB( KU, I+1 )*DCONJG( T )
               END IF
               ABST = ABS( T )
               E( I ) = ABST
               IF( ABST.NE.ZERO ) THEN
                  T = T / ABST
               ELSE
                  T = CONE
               END IF
               IF( WANTPT )
     $            CALL ZSCAL( N, T, PT( I+1, 1 ), LDPT )
               T = AB( KU+1, I+1 )*DCONJG( T )
            END IF
         END IF
  120 CONTINUE
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="ZGBBRD.463"></a><a href="zgbbrd.f.html#ZGBBRD.1">ZGBBRD</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
